Prefer the detected command over generic ConPTY/cmd.exe titles, and detect cmd.exe + Git Bash prompts#103
Merged
Merged
Conversation
On Windows, ConPTY relays a console process's image path as an OSC 0/2 title for every process whether or not it set one — e.g. pnpm's script shell (cmd.exe) broadcasts C:\WINDOWS\system32\cmd.exe, which overrode the detected "pnpm dev:website". Such bare executable paths and shell names carry no command information, so terminalTitleForCommand now ignores them and falls back to the detected command. Descriptive app titles (anything with arguments or text, e.g. "lazygit: dormouse", "README.md - VIM") still override the command as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both shells failed prompt detection, so no prompt shape was ever learned, no command was detected, and the header stayed <idle> — which also meant a meaningful OSC 0 title (e.g. from claude) never surfaced, since titles are shown through a detected command. - cmd.exe: `C:\path>` ends in the terminator with no trailing space, which the generic `[$#%>]\s$` branch rejects. Add a drive-letter-path branch. - Git Bash: its two-line prompt ends in a bare `$ ` (the user@host/path context is on the line above). Accept a bare-terminator final line when the preceding non-blank line carries prompt context. With detection working, commands on these shells get titled and an app's OSC title (claude, vim, …) overrides via the existing command path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cmd.exe sets its console title to "<path>\cmd.exe - <command>" while a command runs, which ConPTY relays as OSC 0 (e.g. "C:\WINDOWS\system32\cmd.exe - pnpm dev:website"). That has spaces so it read as a meaningful title and overrode the detected command with the verbose version. Treat a "<generic interpreter path> - <rest>" title as the interpreter announcing itself: strip the prefix and keep <rest>, so the clean command shows. Genuine app titles (claude, "lazygit: dormouse", "README.md - VIM") are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying mouseterm with
|
| Latest commit: |
d00c79c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fe20a146.mouseterm.pages.dev |
| Branch Preview URL: | https://conpty-titles.mouseterm.pages.dev |
dormouse-bot
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #102 (command detection from the rendered prompt line), covering Windows shells and ConPTY title noise. These commits were developed alongside #102 but left out of that merge.
Problem
On Windows, ConPTY relays a console process's title for every process — frequently just its image path — whether or not the app set a meaningful one. Combined with cmd.exe's habit of titling itself, this clobbered the detected command. And cmd.exe / Git Bash prompts weren't detected at all, so commands on those shells never got a title (stuck at
<idle>), which also meant a real app title (e.g.claude) never surfaced.Changes
Keep the detected command over generic ConPTY process-path titles. A bare executable path (
C:\WINDOWS\system32\cmd.exe) or shell name doesn't override the detected command; descriptive app titles (lazygit: dormouse,README.md - VIM,claude's title) still do.Detect cmd.exe and Git Bash prompts. cmd.exe's
C:\path>ends in the terminator with no trailing space (added a drive-letter-path branch); Git Bash's two-line prompt ends in a bare$validated against theuser@host MINGW64 /pathcontext line above it.Strip cmd.exe's interpreter prefix. cmd sets its title to
<path>\cmd.exe - <command>while running; treat a<generic interpreter path> - <rest>title as cmd announcing itself and keep<rest>, so the clean command shows.Verified live (Windows)
pnpm dev:websiteclaude(OSC 0)Testing
516 unit tests pass (new cases: generic ConPTY path, bare-shell-name, cmd.exe prefix strip, cmd.exe prompt, Git Bash two-line prompt, and a no-context negative);
tsc -bclean; VSCode extension builds.Note
This is the per-shell prompt/title heuristic layer; OSC 633 shell-integration injection remains the durable fix and is intended as its own PR.
🤖 Generated with Claude Code